
<div>
    <input type="hidden" name="{$name}" value="{$value}" />
    <ul class="weui-uploader__files">
        {notempty name="pictures"}
            {volist name="pictures" id="vo"}
                <li class="weui-uploader__file" style="background-image: url(/uploads/picture/{$vo.path});">
                    <a onclick="javascript: del_image_{$name}(this, {$vo.id});" style="padding: 5px;"><i class="fa fa-trash"></i></a>
                </li>
            {/volist}
        {/notempty}
    </ul>
    <div class="weui-uploader__input-box" id="uploader_{$id}"></div>
</div>
<script type="text/javascript">
    function del_image_{$id}(obj, attachId) {
        upAttachVal($('#uploader_{$id}').prevAll("input"), 'del', attachId);
        $(obj).parent().remove();
    };
</script>
<script type="text/javascript">
    $(function(){
        var uploader_{$id} = WebUploader.create({
            swf: '__JS__/plugins/webuploader/Uploader.swf',
            server: "{:url('core/File/uploadPicture')}",
            pick: {
                id: "#uploader_{$id}",
                multi: true
            },
            accept: {
                title: 'Images',
                extensions: 'gif,jpg,jpeg,bmp,png',
                mimeTypes: 'image/*'
            },
            resize: false
        });

        uploader_{$id}.on('fileQueued', function(file) {
            uploader_{$id}.upload();
            toast.showLoading();
        });
        uploader_{$id}.on('uploadSuccess', function(file, ret) {
            if ( ret.status==1 ) {
                toast.success("上传成功");
                $('#uploader_{$id}').prev().append('<li class="weui_uploader__file" style="float: left; margin-right: 9px; margin-bottom: 9px; width: 79px; height: 79px; background: no-repeat center center; background-size: cover; background-image: url(' + ret.data.file.url + ');"><a onclick="del_image_{$id}(this,'+ret.data.file.id+');" style="padding: 5px;"><i class="fa fa-trash"></i></a></li>');
                upAttachVal($('#uploader_{$id}').prevAll("input"), 'add', ret.data.file.id);
            } else { // 上传失败
                toast.error("上传失败"+ret.info);
            }
        });
        uploader_{$id}.on('uploadError', function(file) {
            toast.error("上传失败");
        });
        uploader_{$id}.on('uploadComplete', function(file) {
            toast.hideLoading();
        });

        $("#uploader_{$id}").find(".webuploader-pick").last().css({
            width: "77px",
            height: "77px"
        });
    });
</script>